package com.fenghuajueli.lib_data.entity.db;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Unique;

@Entity
public class MemoDbEntity implements Parcelable {
    @Id(autoincrement = true)
    private Long id;

    @Unique
    private long create_time;
    private String msg;
    @Property
    private boolean isHideTime;
    private boolean isTop;//置顶
    private long isTopTime;//置顶时间
    private String title;
    private long record_time;
    private int type; //0:全部 1:工作 2:生活 3:个人成长 4:开支消费


    protected MemoDbEntity(Parcel in) {
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readLong();
        }
        create_time = in.readLong();
        msg = in.readString();
        isHideTime = in.readByte() != 0;
        isTop = in.readByte() != 0;
        isTopTime = in.readLong();
        title = in.readString();
        record_time = in.readLong();
        type = in.readInt();
    }

    @Generated(hash = 668469009)
    public MemoDbEntity(Long id, long create_time, String msg, boolean isHideTime,
                        boolean isTop, long isTopTime, String title, long record_time, int type) {
        this.id = id;
        this.create_time = create_time;
        this.msg = msg;
        this.isHideTime = isHideTime;
        this.isTop = isTop;
        this.isTopTime = isTopTime;
        this.title = title;
        this.record_time = record_time;
        this.type = type;
    }

    @Generated(hash = 1168057785)
    public MemoDbEntity() {
    }

    public static final Creator<MemoDbEntity> CREATOR = new Creator<MemoDbEntity>() {
        @Override
        public MemoDbEntity createFromParcel(Parcel in) {
            return new MemoDbEntity(in);
        }

        @Override
        public MemoDbEntity[] newArray(int size) {
            return new MemoDbEntity[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(id);
        }
        dest.writeLong(create_time);
        dest.writeString(msg);
        dest.writeByte((byte) (isHideTime ? 1 : 0));
        dest.writeByte((byte) (isTop ? 1 : 0));
        dest.writeLong(isTopTime);
        dest.writeString(title);
        dest.writeLong(record_time);
        dest.writeInt(type);
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public long getCreate_time() {
        return this.create_time;
    }

    public void setCreate_time(long create_time) {
        this.create_time = create_time;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean getIsHideTime() {
        return this.isHideTime;
    }

    public void setIsHideTime(boolean isHideTime) {
        this.isHideTime = isHideTime;
    }

    public boolean getIsTop() {
        return this.isTop;
    }

    public void setIsTop(boolean isTop) {
        this.isTop = isTop;
    }

    public long getIsTopTime() {
        return this.isTopTime;
    }

    public void setIsTopTime(long isTopTime) {
        this.isTopTime = isTopTime;
    }

    public String getTitle() {
        return this.title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public long getRecord_time() {
        return this.record_time;
    }

    public void setRecord_time(long record_time) {
        this.record_time = record_time;
    }

    public int getType() {
        return this.type;
    }

    public void setType(int type) {
        this.type = type;
    }
}
